<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />
    
    <?php use_stylesheet('jquery.treeview.css'); ?>
    <?php include_stylesheets() ?>
    <?php use_javascript('jquery-1.4.2.min.js') ?>
    <?php use_javascript('jquery.cookie.js'); ?>
    <?php use_javascript('jquery.treeview.js'); ?>
    <?php use_javascript('tiny_mce/tiny_mce'); ?>
    <?php include_javascripts() ?>
    <script type="text/javascript">
        $(document).ready(function(){
        $(".tree").treeview({
		animated: "fast",
		collapsed: true,
		unique: true,
		persist: "cookie",
		toggle: function() {
			window.console && console.log("%o was toggled", this);
		}
	});
        });
    </script>
  </head>
  <body>
      
    <div id="Header">
        <div class="Logo"><?php echo link_to(image_tag('logo.gif', array('border' => 0, 'alt' => "Submitearticles")), '@homepage'); ?></div>
	<div class="Login">
            <?php if(!$sf_user->isAuthenticated()): ?>
            <form action="<?php echo url_for('user/check'); ?>" method="post">
                <div class="LoginR1">
                    <input type="text" name="user[user_id]" value="Username" class="loginput" onfocus="javascript:this.value='';" />
                    <input type="password" name="user[pwd]" value="Password" class="loginput" onfocus="javascript:this.value='';" />
                    <input type="submit" name="login" value="" class="logsubmit" />
                </div>
                <div class="LoginR1"><a href="<?php echo url_for('@forgot_password'); ?>">Forgot Password</a> | <a href="<?php echo url_for('user/new'); ?>">New User</a></div>
	    </form>
            <?php else: ?>
            <div class="LoginR1"><?php echo link_to('Logout', '@logout', array('style'=>'text-decoration:underline; line-height:24px;padding-bottom:5px;')); ?></div>
            <?php endif; ?>
        </div>
    </div>
    <div id="MiddleCont">
        <table cellspacing="10" cellpadding="0" style="width: 100px;" align="center">
		<tr>
			<td valign="top" align="left">
			<?php include_partial('home/leftsidebar'); ?>
			</td>
			<td valign="top" style="width:100%" >
				<div id="MidCol">
					<div id="ArtCategory">
                                            <?php 
                                            include_component('home', 'categoryBlock');
                                            ?>
					</div>
					<div id="ReApvArticles">
                                            <?php echo $sf_content; ?>
                                            <div class="Bottom"><b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b></b></div>
					</div>
				</div>
			</td>
			<td valign="top">
				<div id="RightCol">
                                    <div class="SearchBox">
					<h2>search articles</h2>
					<form action="<?php echo url_for('@search'); ?>" name="frmSearch" method="get">
                                            <input type="text" name="keyword" value="Search" class="searchinput" onclick="javascript:this.value='';" />
                                            <input type="submit" name="search" value="" class="searchbutton" />
					</form>
				    </div>
                                    <div class="AuthorSpot">
                                         <?php include_component('home','topAuthors'); ?>
                                    </div>
                                    <div class="AuthorSpot">
                                         <?php include_component('home','mostViewedArticles'); ?>
                                    </div>
                                    <div class="AuthorSpot">
                                         <?php include_component('home','mostDiscussedArticles'); ?>
                                    </div>
				</div>
			</td>
		</tr>
	</table>
    
    </div>
    <div id="Footer">&copy;<?php echo date('Y'); ?> <?php echo link_to("Submitearticles.com", '@homepage', array('absolute'=>true)); ?>. All rights reserved.</div>
  <script language="javascript" type="text/javascript">
      $("div#comment_message").hide();
     
       // var postID;
        var voteDownScript= "<?php echo url_for('@comment_down'); ?>";
        var voteUpScript  = "<?php echo url_for('@comment_up'); ?>";
        var abuseScript   = "<?php echo url_for('@abuse_comment'); ?>";
        $("a.up").click(function(){ // when people click an up button

//            $("div#response").show().html('<h2>voting, please wait...</h2>'); // show wait message

            itemIDArr = $(this).attr('id').split("_"); // get post id
            itemID = itemIDArr[1];
            
            $.post(voteUpScript,{id:itemID},function(response)
            { // post to up script
              $("div#response_"+itemID).html(response);
              //
                    //$("div#response").html(response).hide(3000); // show response
            });
            //$(this).style.display = 'none';
            //$(this).attr({"disabled":"disabled"}); // disable button
        });

         // vote down
         $("a.down").click(function(){
//                $("div#response_"+itemID).show().html('<h2>voting, please wait...</h2>');
                
                itemIDArr = $(this).attr('id').split("_"); // get post id
                itemID = itemIDArr[1];
                $.post(voteDownScript,{id:itemID},function(response){ // post to down script
                  $("div#response_"+itemID).html(response);
                       // $("div#response").html(response).hide(3000); // show response
                });
                //$(this).style.display = 'none';
                //$(this).attr({"disabled":"disabled"}); // disable button

         });
         $("a.abuse").click(function(){
             
             itemIDArr = $(this).attr('id').split("_");
             itemID    = itemIDArr[1];
             $.post(abuseScript, {id:itemID}, function(response)
             {
                 $("div#comment_message").html(response).show().fadeOut(10000);
             });
         });
    </script>
  </body>
</html>